<div class="row">
	<div class="col-lg-12">
		<h1 class="site-h1" style="background-color:#FFFFFF;">
			租户列表<#if userList??>（${userList.totalElements!''}）</#if>
			<div class="ukefu-bt-text-content" style="position: absolute;right: 80px;top: 3px;">
				<form class="layui-form" name="search" action="/admin/multitenant/index.html" method="get" style="float: left;">
					<div class="layui-form-item">
						<div class="layui-inline">
							<div class="layui-input-inline">
								<input type="text" name="q" value="${q!''}" style="height: 30px;line-height: 30px;margin-top: 4px;border: 1px solid #32c24d;"
									placeholder="请输入查询条件" autocomplete="off" class="layui-input">
								<i class="layui-icon" onclick="search.submit()" style="position: absolute;cursor: pointer;right: 3px;top: 4px;font-size: 20px;color:#32c24d;">&#xe615;</i>
							</div>
						</div>
					</div>
				</form>
			</div>
			<span style="float:right;">
				<button class="layui-btn layui-btn-sm green" href="/admin/multitenant/add.html" data-toggle="ajax" data-width="550" data-height="450" data-title="创建新租户">
					创建新租户
				</button>
			</span>
		</h1>
		<div class="row" style="padding:5px;">
			<div class="col-lg-12">
				<table class="layui-table" lay-skin="line">
				  <colgroup>
						<col width="10%">
						<col width="10%">
					  <col width="10%">
					  <col width="10%">
					  <col width="10%">
					  <col width="10%">
						<col width="1%">
						<col>
				  </colgroup>
				  <thead>
				  <#if userList?? && userList.content?? && userList.content?size gt 0>
					<tr>
					  <th>租户名</th>
					  <th>租户ID</th>
						<th>文本坐席数量</th>
						<th>呼叫中心坐席数量</th>
						<th>电销机器人并发数量</th>
						<th>数据状态</th>
					  <th style="white-space:nowrap;" nowrap="nowrap">操作</th>
					</tr> 
					</#if>
				  </thead>
				  <tbody>
					<#if userList?? && userList.content?? && userList.content?size gt 0>
					<#list userList.content as user>
					<tr>
					  <td>
							<a href="javascript:void(0)" onclick="return false;" data-title="【${user.tenantname!''}】租户信息" data-href="/admin/multitenant/user/index.html?tenantcode=${user.tenantcode!''}" data-id="_${user.id!''}" data-type="tabAdd" data-toggle="tab" >${user.tenantname!''}</a>
					  </td>
					  <td>${user.tenantcode!''}</td>
						<td>${user.agentnum!''}</td>
						<td>${user.callcenteragentnum!''}</td>
						<td>${user.robotagentnum!''}</td>
						<td><#if user.datastatus == true >删除</#if><#if user.datastatus == false >启用</#if></td>
					  <td style="white-space:nowrap;" nowrap="nowrap">
							  <#if !(user.usertype?? && user.usertype == "0") && user.datastatus != true >
							  <a href="/admin/multitenant/edit.html?id=${user.id!''}" style="margin-left:10px;" data-toggle="ajax" data-width="550" data-height="450" data-title="编辑租户信息" >
								  编辑
							  </a>
							  </#if>
					  		<#if !(user.usertype?? && user.usertype == "0") && user.datastatus != true >
					  		<a href="/admin/multitenant/delete.html?id=${user.id!''}" style="margin-left:10px;" data-toggle="tip" data-title="请确认是否删除该租户？">
					  			<i class="layui-icon" style="color:red;">&#x1006;</i>
					  			删除
					  		</a>
					  		</#if>
					  </td>
					</tr>
					</#list>
					<#else>
						<div class="ukefu-empty">
							<i class="layui-icon"></i>
							<div style="">
								还没有租户记录
							</div>
						</div>
					</#if>
				  </tbody>
				</table>
			</div> 	   
		</div>
		<div class="row" style="padding:5px;">
			<div class="col-lg-12" id="page" style="text-align:center;"></div>
		</div>
	</div>	
</div>
<script>
	layui.use('layer', function(){
	  var layer = layui.layer;
	  <#if msg?? && msg == 'username_exist'>
		layer.alert('用户名存在，请重新填写', {icon: 2});
	  <#elseif msg?? && msg == 'email_exist'>
		layer.alert('邮件存在，请重新填写', {icon: 2});
	  <#elseif msg?? && msg == 'mobile_exist'>
		layer.alert('手机存在，请重新填写', {icon: 2}); 
	  <#elseif msg?? && msg == 't1'>
		layer.alert('当前用户坐席就绪或对话未结束，不能切换为非坐席', {icon: 2});
	  <#elseif msg?? && msg == 'ext_exist'>
		layer.alert('分机已绑定其他坐席，请选择其他分机', {icon: 2});
	  <#elseif msg?? && msg == 'admin_tenantcode_already_exist'>
		layer.alert('租户ID已存在，请重新填写', {icon: 2});

	<#elseif msg?? && msg == 'login_error_user_not_exist'>
		layer.alert('登录用户不存在', {icon: 2});
	<#elseif msg?? && msg == 'user_not_exsit_or_role_not_exist'>
		layer.alert('登录用户不存在或者当前用户权限不够', {icon: 2});
	</#if>
	});
	layui.use(['laypage', 'layer'], function(){
		  var laypage = layui.laypage
		  ,layer = layui.layer;
		  
		  laypage.render({
				elem: 'page'
				,pages: <#if userList??>${userList.totalPages}<#else>0</#if> //总页数
				,curr:<#if userList??>${userList.number+1}<#else>0</#if>
				,groups: 5 //连续显示分页数
				,jump:function(data , first){
					if(!first){
						location.href = "/admin/multitenant/index.html?p="+data.curr <#if q != '' && q??>+"&q="+${q!''}</#if>;
					}
				}
		   });
		});
</script>